package lib.pacificapp.widget;

import android.content.Context;
import android.support.v4.view.MotionEventCompat;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.FrameLayout;

public class ClearLayout  extends FrameLayout {
 
    private String TAG = ClearLayout.class.getSimpleName();
 
    public ClearLayout(Context context) {
        super(context);
 
    }
 
    public ClearLayout(Context context, AttributeSet attrs) {
    	super(context, attrs);
    }
 
   
 
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        boolean result = super.dispatchTouchEvent(ev) ;
  
        return result;
    }
 
    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev){ 
        final int action = MotionEventCompat.getActionMasked(ev);
        // Always handle the case of the touch gesture being complete.
        if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {
            // Do not intercept touch event, let the child handle it
             return false;
        }
 
        //TouchUtils.showEventInfo(TAG + "#   onInterceptTouchEvent", action);
        getParent().requestDisallowInterceptTouchEvent(true);
     
        return false;
    }
 
    @Override
    public boolean onTouchEvent(MotionEvent ev) {
    	 getParent().requestDisallowInterceptTouchEvent(true);
         return super.onTouchEvent(ev);
 
    }
     
}
